import { request } from '@/service/request';

// ---------- RecycleBin Begin ----------

/** get recycleBin list */
export function fetchGetDmRecycleBinPage(params?: Api.Dimo.DmRecycleBinSearchParams) {
  return request<Api.Dimo.DmRecycleBinList>({
    url: '/dm_recycle_bin/page',
    method: 'GET',
    params
  });
}

export function fetchGetDmRecycleBin(id: string) {
  return request<Api.Dimo.Company>({
    url: `/dm_recycle_bin/${id}`,
    method: 'GET'
  });
}

/** add recycleBin info */
export function fetchAddDmRecycleBin(data: Api.Dimo.DmRecycleBinEdit) {
  return request<boolean>({
    url: '/dm_recycle_bin/',
    method: 'POST',
    data
  });
}

/** update recycleBin info */
export function fetchUpdateDmRecycleBin(data: Api.Dimo.DmRecycleBinEdit) {
  return request<boolean>({
    url: '/dm_recycle_bin/',
    method: 'PUT',
    data
  });
}

/** edit delete recycleBin */
export function fetchDeleteDmRecycleBin(data: Api.Common.DeleteParams) {
  return request<boolean>({
    url: '/dm_recycle_bin/',
    method: 'DELETE',
    data
  });
}

/** auth */
export function fetchAuthDmRecycleBin(data: { id: string, status: string }) {
  return request<boolean>({
    url: `/dm_recycle_bin/auth`,
    method: 'PUT',
    data
  });
}

// 导出

export function fetchAuthDmRecycleBinExport(data: Api.Dimo.DmExportParams) {
  return request<boolean, 'blob' | 'json'>({
    url: `/dm_recycle_bin/export_data`,
    method: 'POST',
    data,
    responseType: 'blob'
  });
}
